home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
PROGASIC
/
BASFILES.LZH
/
SCROLBOX.BAS
< prev
next >
Wrap
BASIC Source File
|
1988-09-10
|
6KB
|
290 lines
'$INCLUDE:'QBTOOLS.INC'
'' '$INCLUDE: 'qbtools2.inc'
'DIM Sc$(300)
'ct% = 0
'FOR j% = 1 TO 300
' ct% = ct% + 1
'
' IF ct% > 26 THEN
' ct% = 0
' END IF
'
' Sc$(j%) = CHR$(64 + ct%) + " Test" + STR$(j%)
'NEXT j%
'wd% = 10
'Hg% = 9
'bx% = 10
'by% = 5
'fc% = 7
'tf% = 7
'gb% = 0
'hb% = 7
'hf% = 0
'ss% = 1
'El% = 100
'Aesc% = 1
'Atb% = 1
'Af10% = 1
'Rv% = 57
'ScrollBox Sc$(), wd%, Hg%, bx%, by%, fc%, tf%, gb%, hb%, hf%, ss%, El%, Aesc%, Atb%, Af10%, Rv%, Rst$, GlbErr%
'
' New Scroll Box
'
' Passed Values
' Rv% .. if it's set, then the box will Start display at that point
' Atb% .. if =1 then allows Tab
' Af10% .. if =1 then allows F10 to be pressed
'
' On return...
'
' If Rv% = -1% then Af10% (F10) was pressed
' If Rv% > El% then TAB was pressed (Use Rv%=Rv%-El%) to get the proper Rv%
'
'
SUB ScrollBox (sc$(), wd%, hg%, bx%, by%, fc%, Tf%, Gb%, Hbgd%, Hf%, ss%, el%, Ok%(), rv%, rst$, GlbErr%) STATIC
REDIM scsav%(2000) ' Screen save
ExKeys% = UBOUND(Ok%, 1) ' Exit Keys
GlbErr% = 0 ' Initialize the error msg
rh% = hg% + 2 ' Real height (with frame)
rw% = wd% + 2 ' Real width (with frame)
chkx% = bx% + rw% - 1 ' Check for overflow
IF chkx% > 80 THEN
GlbErr% = 1 ' Frame too wide
EXIT SUB
END IF
chky% = rh% + by% - 1 ' Check for overflow
IF chky% > 24 THEN
GlbErr% = 2 ' Frame too tall
EXIT SUB
END IF
Col1% = Attributes%(fc%, Gb%, 0, 0)
Col2% = Attributes%(Tf%, Gb%, 0, 0)
Col3% = Attributes%(Hf%, Hbgd%, 0, 0)
IF ss% = 1 THEN ' Save the screen
GetScreen scsav%(0), by%, bx%, chky%, chkx% ' Fastest
END IF
' Draw the box first
' This version uses only the
' narrow single drawing char.
ColorPrint CHR$(218) + STRING$(wd%, 196) + CHR$(191), by%, bx%, Col1% ' Top line
FOR j% = by% + 1 TO chky% - 1 ' Loop through....
ColorPrint CHR$(179), j%, bx%, Col1% ' Print the left border
ColorPrint CHR$(179), j%, chkx%, Col1% ' Print the right border
NEXT j%
ColorPrint CHR$(192) + STRING$(wd%, 196) + CHR$(217), chky%, bx%, Col1%
IF rv% > el% THEN
rv% = el%
END IF
Sv% = 1 ' Where highlit value starts
Tv% = 1 ' Where current value is
IF Tv% < rv% THEN
Tv% = rv%
Sv% = Tv%
END IF
scex% = 0 ' Do not exit
WHILE scex% = 0 ' While at this value
FOR j% = 1 TO hg% ' Display this many lines
IF (j% - 1 + Tv%) > el% THEN
text$ = STRING$(wd%, 32)
ELSE
text$ = sc$(j% - 1 + Tv%) ' Set the text equal value
END IF
IF LEN(text$) < wd% THEN ' Too small
text$ = text$ + STRING$(wd% - LEN(text$), 32)
END IF
IF LEN(text$) > wd% THEN
text$ = LEFT$(text$, wd%)
END IF
IF (j% - 1 + Tv%) = Sv% THEN
ColorPrint text$, j% + by%, bx% + 1, Col3%
ELSE
ColorPrint text$, j% + by%, bx% + 1, Col2%
END IF
NEXT j%
w$ = ""
WHILE w$ = ""
w$ = INKEY$
WEND
IF LEN(w$) = 1 THEN
Ch% = ASC(w$)
SELECT CASE Ch%
CASE 9
IF ExKeys% >= 42 THEN
IF Ok%(42) = 1 THEN
rv% = -42
rst$ = sc$(Sv%)
scex% = 1
END IF
END IF
CASE 13
rv% = Sv%
rst$ = sc$(Sv%)
scex% = 1
CASE 27
IF ExKeys% > 40 THEN
IF Ok%(41) = 1 THEN
rv% = -41
rst$ = ""
scex% = 1
END IF
END IF
CASE ELSE
Np% = 0
FOR k% = Sv% + 1 TO el%
IF UCASE$(LEFT$(sc$(k%), 1)) = UCASE$(CHR$(Ch%)) THEN
Np% = k%
EXIT FOR
END IF
NEXT k%
IF Np% = 0 THEN
FOR k% = 1 TO Sv% - 1
IF UCASE$(LEFT$(sc$(k%), 1)) = UCASE$(CHR$(Ch%)) THEN
Np% = k%
EXIT FOR
END IF
NEXT k%
END IF
IF Np% THEN
Tv% = Np%
Sv% = Tv%
END IF
Np% = 0
IF Sv% > el% THEN
Sv% = el%
Tv% = (Sv% - hg%) + 1
IF Tv% < 1 THEN
Tv% = 1
END IF
END IF
END SELECT
ELSE
Ch% = ASC(MID$(w$, 2))
IsFunction% = CheckFunction%(Ch%)
IF IsFunction% THEN
IF ExKeys% >= IsFunction% THEN
IF Ok%(IsFunction%) THEN
rv% = -IsFunction%
scex% = 1
END IF
END IF
END IF
IF Ch% = 72 THEN ' Up arrow
Sv% = Sv% - 1
IF Sv% < Tv% THEN
Tv% = Tv% - 1
END IF
IF Sv% = 0 THEN
Sv% = 1
END IF
IF Tv% = 0 THEN
Tv% = 1
END IF
END IF
IF Ch% = 80 THEN ' Down arrow
IF Sv% < el% THEN
Sv% = Sv% + 1
IF (Tv% + hg% - 1) < Sv% THEN
Tv% = Tv% + 1
END IF
END IF
END IF
IF Ch% = 71 THEN ' Home
Sv% = 1
Tv% = 1
END IF
IF Ch% = 79 THEN ' End
Sv% = el%
Tv% = (Sv% - hg%) + 1
IF Tv% < 1 THEN
Tv% = 1
END IF
END IF
IF Ch% = 81 THEN ' Page down
Sv% = Sv% + hg%
Tv% = Tv% + hg%
IF el% < (Tv% + hg%) - 1 AND ((Sv% - Tv%) + 1) < hg% THEN
Tv% = (Sv% - hg%) + 1
END IF
IF Sv% > el% THEN
Sv% = el%
Tv% = (Sv% - hg%) + 1
IF Tv% < 1 THEN
Tv% = 1
END IF
END IF
END IF
IF Ch% = 73 THEN ' Page up
Sv% = Sv% - hg%
Tv% = Tv% - hg%
IF Tv% < 1 THEN
IF Sv% < 1 THEN
Sv% = 1
END IF
Tv% = 1
END IF
END IF
END IF
WEND
IF ss% = 1 THEN ' Save the screen
PutScreen scsav%(0), by%, bx%, chky%, chkx% ' Fastest
END IF
END SUB